4e65a365ca44ff3be49f818bb7669eb5791aab12,src/web/org/codehaus/groovy/grails/web/binding/GrailsDataBinder.java,GrailsDataBinder,checkStructuredDateDefinitions,#ServletRequest#MutablePropertyValues#,324
Before Change
int month = Integer.parseInt(getParameterValue(request, propertyName + "_month","1"));
int day = Integer.parseInt(getParameterValue(request, propertyName + "_day","1"));
int hour = Integer.parseInt(getParameterValue(request, propertyName + "_hour","0"));
int minute = Integer.parseInt(getParameterValue(request, propertyName + "_minute","0"));
Calendar c = new GregorianCalendar(year,month - 1,day,hour,minute);
if(type == Date.class)
After Change
return returnValue;
}
private void checkStructuredDateDefinitions(ServletRequest request, MutablePropertyValues propertyValues) {
PropertyValue[] pvs = propertyValues.getPropertyValues();
for (int i = 0; i < pvs.length; i++) {
PropertyValue propertyValue = pvs[i];
try {
String propertyName = propertyValue.getName();
Class type = bean.getPropertyType(propertyName);
// if its a date check that it hasn't got structured parameters in the request
// this is used as an alternative to specifying the date format
if(type == Date.class || type == Calendar.class) {
try {
PropertyValue yearProperty = propertyValues.getPropertyValue(propertyName + "_year");
// The request will always include the year value
String yearString = (String) yearProperty.getValue();
int year;
if(StringUtils.isBlank(yearString)) {
Calendar now = Calendar.getInstance(RequestContextUtils.getLocale((HttpServletRequest) request));
year = now.get(Calendar.YEAR);
}
else {
year = Integer.parseInt(yearString);
}
int month = getIntegerPropertyValue(propertyValues, propertyName + "_month", 1);
int day = getIntegerPropertyValue(propertyValues, propertyName + "_day", 1);
int hour = getIntegerPropertyValue(propertyValues, propertyName + "_hour", 0);
int minute = getIntegerPropertyValue(propertyValues, propertyName + "_minute", 0);
Calendar c = new GregorianCalendar(year,month - 1,day,hour,minute);
if(type == Date.class)